package top.atcra.rpc.serialization;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum SerializerType {
    jdk((byte) 0),
    json((byte) 1),
    hessian((byte) 2);
    private final byte id;
    private static final Map<Byte, SerializerType> map = new HashMap<>() {{
        for (SerializerType type : SerializerType.values()) {
            put(type.getId(), type);
        }
    }};

    public static SerializerType valueOf(byte id) {
        return map.get(id);
    }
}